var initGalleryTab = function() {
		YEvent.delegate("galleryListTable", "click", viewGallery, '.view-gallery-link');
		YEvent.delegate("galleryListTable", "click", deleteGallery, '.delete-gallery-link');
};
	
var viewGallery = function(event) {
	
	// 'this' refers to element that was clicked
	var parentRow = getParentRow(this);
	// Make xhr call get entity details
	var id = parentRow.readAttribute("galleryId");
	getTabContent("gallery/edit?galleryId="+id);
	
};




var createNewGallery = function() {
	goToTab("GALLERY");
	getTabContent("gallery/add");
		
};

var returnToGalleryList = function() {
	getTabContent("gallery");
};


var deleteGallery = function(event){
	
	
	if (confirm("Are you want to delete?")) {
		// 'this' refers to element that was clicked
		var parentRow = getParentRow(this);
		// Make xhr call get entity details
		var id = parentRow.readAttribute("galleryId");
		getTabContent("gallery/delete?galleryId="+id);
	} else {
		return false;
	}
};